.class public Lcom/melesta/payment/amazon/PaymentSystem;
.super Ljava/lang/Object;
.source "PaymentSystem.java"

# interfaces
.implements Lcom/melesta/payment/interfaces/ISystem;


# static fields
.field public static final SYSTEM_NAME:Ljava/lang/String; = "amazon"


# instance fields
.field private defaultListener:Lcom/melesta/payment/interfaces/IListener;

.field private mContext:Landroid/content/Context;

.field private mObserver:Lcom/melesta/payment/amazon/PurchasingObserver;


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 15
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public buy(Lcom/melesta/payment/amazon/Request;)V
    .locals 8
    .parameter "request"

    .prologue
    const-wide/16 v6, -0x1

    .line 25
    new-instance v4, Lcom/melesta/payment/PaymentTransaction;

    invoke-direct {v4}, Lcom/melesta/payment/PaymentTransaction;-><init>()V

    .line 26
    .local v4, tr:Lcom/melesta/payment/PaymentTransaction;
    invoke-virtual {p1}, Lcom/melesta/payment/amazon/Request;->getName()Ljava/lang/String;

    move-result-object v5

    iput-object v5, v4, Lcom/melesta/payment/PaymentTransaction;->paymentId:Ljava/lang/String;

    .line 27
    invoke-virtual {p0}, Lcom/melesta/payment/amazon/PaymentSystem;->getName()Ljava/lang/String;

    move-result-object v5

    iput-object v5, v4, Lcom/melesta/payment/PaymentTransaction;->paymentSystem:Ljava/lang/String;

    .line 28
    const/4 v5, 0x1

    iput v5, v4, Lcom/melesta/payment/PaymentTransaction;->quantity:I

    .line 30
    invoke-static {}, Lcom/melesta/engine/EngineActivity;->getInstance()Lcom/melesta/engine/EngineActivity;

    move-result-object v5

    invoke-static {v5}, Lcom/melesta/engine/DatabaseHelper;->getHelper(Landroid/content/Context;)Lcom/melesta/engine/DatabaseHelper;

    move-result-object v0

    .line 32
    .local v0, databaseHelper:Lcom/melesta/engine/DatabaseHelper;
    invoke-virtual {v0, v6, v7, v4}, Lcom/melesta/engine/DatabaseHelper;->saveTransaction(JLcom/melesta/payment/PaymentTransaction;)J

    move-result-wide v1

    .line 34
    .local v1, id:J
    invoke-virtual {p1}, Lcom/melesta/payment/amazon/Request;->getSku()Ljava/lang/String;

    move-result-object v5

    invoke-static {v5}, Lcom/amazon/inapp/purchasing/PurchasingManager;->initiatePurchaseRequest(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    .line 35
    .local v3, requestId:Ljava/lang/String;
    invoke-virtual {p1, v3}, Lcom/melesta/payment/amazon/Request;->setId(Ljava/lang/String;)Lcom/melesta/payment/amazon/Request;

    .line 36
    iput-object v3, v4, Lcom/melesta/payment/PaymentTransaction;->customData:Ljava/lang/String;

    .line 37
    invoke-virtual {v0, v6, v7, v4}, Lcom/melesta/engine/DatabaseHelper;->saveTransaction(JLcom/melesta/payment/PaymentTransaction;)J

    move-result-wide v1

    .line 38
    return-void
.end method

.method public get(Ljava/lang/String;)Ljava/lang/Object;
    .locals 1
    .parameter "property"

    .prologue
    .line 93
    const/4 v0, 0x0

    return-object v0
.end method

.method public getDefaultListener()Lcom/melesta/payment/interfaces/IListener;
    .locals 1

    .prologue
    .line 102
    iget-object v0, p0, Lcom/melesta/payment/amazon/PaymentSystem;->defaultListener:Lcom/melesta/payment/interfaces/IListener;

    return-object v0
.end method

.method public getName()Ljava/lang/String;
    .locals 1

    .prologue
    .line 82
    const-string v0, "amazon"

    return-object v0
.end method

.method public getRequestBuilder()Lcom/melesta/payment/interfaces/IRequestBuilder;
    .locals 1

    .prologue
    .line 77
    new-instance v0, Lcom/melesta/payment/amazon/RequestBuilder;

    invoke-direct {v0, p0}, Lcom/melesta/payment/amazon/RequestBuilder;-><init>(Lcom/melesta/payment/amazon/PaymentSystem;)V

    return-object v0
.end method

.method public onActivityResult(Landroid/content/Context;IILandroid/content/Intent;)Z
    .locals 1
    .parameter "context"
    .parameter "requestCode"
    .parameter "resultCode"
    .parameter "data"

    .prologue
    .line 108
    const/4 v0, 0x0

    return v0
.end method

.method public onCreate(Landroid/content/Context;Landroid/os/Handler;)V
    .locals 0
    .parameter "context"
    .parameter "handler"

    .prologue
    .line 42
    iput-object p1, p0, Lcom/melesta/payment/amazon/PaymentSystem;->mContext:Landroid/content/Context;

    .line 43
    return-void
.end method

.method public onDestroy(Landroid/content/Context;Landroid/os/Handler;)V
    .locals 0
    .parameter "context"
    .parameter "handler"

    .prologue
    .line 47
    iput-object p1, p0, Lcom/melesta/payment/amazon/PaymentSystem;->mContext:Landroid/content/Context;

    .line 48
    return-void
.end method

.method public onPause(Landroid/content/Context;Landroid/os/Handler;)V
    .locals 0
    .parameter "context"
    .parameter "handler"

    .prologue
    .line 65
    iput-object p1, p0, Lcom/melesta/payment/amazon/PaymentSystem;->mContext:Landroid/content/Context;

    .line 66
    return-void
.end method

.method public onResume(Landroid/content/Context;Landroid/os/Handler;)V
    .locals 0
    .parameter "context"
    .parameter "handler"

    .prologue
    .line 70
    iput-object p1, p0, Lcom/melesta/payment/amazon/PaymentSystem;->mContext:Landroid/content/Context;

    .line 72
    invoke-static {}, Lcom/amazon/inapp/purchasing/PurchasingManager;->initiateGetUserIdRequest()Ljava/lang/String;

    .line 73
    return-void
.end method

.method public onStart(Landroid/content/Context;Landroid/os/Handler;)V
    .locals 1
    .parameter "context"
    .parameter "handler"

    .prologue
    .line 52
    iput-object p1, p0, Lcom/melesta/payment/amazon/PaymentSystem;->mContext:Landroid/content/Context;

    .line 54
    new-instance v0, Lcom/melesta/payment/amazon/PurchasingObserver;

    invoke-direct {v0, p1, p0}, Lcom/melesta/payment/amazon/PurchasingObserver;-><init>(Landroid/content/Context;Lcom/melesta/payment/amazon/PaymentSystem;)V

    iput-object v0, p0, Lcom/melesta/payment/amazon/PaymentSystem;->mObserver:Lcom/melesta/payment/amazon/PurchasingObserver;

    .line 55
    iget-object v0, p0, Lcom/melesta/payment/amazon/PaymentSystem;->mObserver:Lcom/melesta/payment/amazon/PurchasingObserver;

    invoke-static {v0}, Lcom/amazon/inapp/purchasing/PurchasingManager;->registerObserver(Lcom/amazon/inapp/purchasing/PurchasingObserver;)V

    .line 56
    return-void
.end method

.method public onStop(Landroid/content/Context;Landroid/os/Handler;)V
    .locals 0
    .parameter "context"
    .parameter "handler"

    .prologue
    .line 60
    iput-object p1, p0, Lcom/melesta/payment/amazon/PaymentSystem;->mContext:Landroid/content/Context;

    .line 61
    return-void
.end method

.method public purchaseProcessed(Lcom/melesta/payment/PaymentTransaction;)V
    .locals 0
    .parameter "pt"

    .prologue
    .line 115
    return-void
.end method

.method public set(Ljava/lang/String;Ljava/lang/Object;)Lcom/melesta/payment/interfaces/ISystem;
    .locals 0
    .parameter "property"
    .parameter "value"

    .prologue
    .line 88
    return-object p0
.end method

.method public setDefaultListener(Lcom/melesta/payment/interfaces/IListener;)Lcom/melesta/payment/interfaces/ISystem;
    .locals 0
    .parameter "defListener"

    .prologue
    .line 97
    iput-object p1, p0, Lcom/melesta/payment/amazon/PaymentSystem;->defaultListener:Lcom/melesta/payment/interfaces/IListener;

    .line 98
    return-object p0
.end method
